package com.pcjavanet.collect.mes.util;


import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;

import org.apache.log4j.Logger;

/**
 * class ConvertFormula is used to convert numberic.
 * @author kenny_li
 * @version 1.0
 * @date 2007-09-04 10:00:00
 */
public class ConvertFormula implements Serializable{

	/**
	 * serialVersionUID.
	 */
	private static final long serialVersionUID = 1L;
	
	protected static Logger logger = Logger.getLogger(ConvertFormula.class);
	
	public static String DATE_FORMAT_LONG="yyyy-MM-dd HH:mm:ss";
	
	public static String DATE_FORMAT_LONG_WITH_TIMEZONE="yyyy-MM-dd HH:mm:ss Z";
	
	private static String DATE_FORMAT_SHORT="yyyy-MM-dd";
	
	private static String DATE_FORMAT_SLASH="MM/dd/yyyy";
	
	private static String TIME_FORMAT="HH:mm:ss";
	
	public static int[] monthDaysDistribute ={31,28,31,30,31,30,31,31,30,31,30,31};
	
	public static int START_YEAR = 1970;
	
//	private static TimeZone zone = new ZoneInfo("GMT", 0);
	@SuppressWarnings("unused")
	private static TimeZone zone = TimeZone.getTimeZone("GMT-0");

	public static String formatDateToSlashStr( Date date ) {
		SimpleDateFormat sdf=new SimpleDateFormat( DATE_FORMAT_SLASH );
		String dateStr = "";
		try {
			dateStr = sdf.format( date );
		}catch ( Exception e) {
			logger.error( e );
		} 
		return dateStr ; 
	}
	
	/**
	 * convert time to long.
	 * @param strDate
	 * @return time -long
	 */
	public static long convertTimeToLong(String strDate){
		
		SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT_LONG);
    	Date date=new Date();
		try {
			date=sdf.parse(strDate);
		}catch (java.text.ParseException e) {
			logger.error( e );
		}
    	Calendar calendar = GregorianCalendar.getInstance();    	
    	calendar.setTime(date);
    	long offSet= calendar.getTimeZone().getRawOffset();
    	long time=(calendar.getTimeInMillis()+offSet)/1000;
    	return time;
    	
	}

	
	public static String formataDateTimeToDateStr( String timezone ,long aDateTime ) {
		long localOffset = TimeZone.getDefault().getRawOffset() ; 
		long sfdcOffset = TimeZone.getTimeZone(timezone).getRawOffset();
		long offset =  sfdcOffset - localOffset ;
		long misecond = aDateTime* 1000 + offset ; 
		return formateMilsecondToLenStr( misecond );
	}
	/**
	 * conver sencond to GST time.
	 * 
	 * @param seconds seconds.
	 * @return GST time string.
	 */
	public static String converSecondToString(long seconds) {
//		System.getProperties().setProperty("user.timezone", "GMT-0");
		long time= seconds * 1000;
    	SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT_LONG);
//    	sdf.setTimeZone(zone);
    	Date date=new Date(time);
    	return sdf.format(date);
	}
	
	/**
	 * 
	 * @param millis millis second
	 * @return  yyyy-MM-dd HH:mm:ss
	 */
	public static String conveMillisToString(long millis) {
		SimpleDateFormat sdf=new SimpleDateFormat( DATE_FORMAT_LONG );
		Date date=new Date(millis);
		return sdf.format(date);
	}
	
	/**
	 * change date string to second
	 * @param strDate
	 * @return
	 */
	public static long converDateStrToSecond( String strDate ) {
//		System.getProperties().setProperty("user.timezone", "GMT-0");
		SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT_LONG);
//		sdf.setTimeZone(zone);
    	Date date= null ;
		try {
			if ( strDate.length() <= 10 ) {
				strDate = strDate + " 00:00:00";
			}
			date=sdf.parse(strDate);
		}catch (java.text.ParseException e) {
			logger.error( e );
		}
		return date.getTime()/1000 ; 
	} 
	
	/**
	 * change date string to second
	 * @param strDate
	 * @return
	 */
	public static long converDateStrToSecond( String strDate,String timeZoneID ) {
		SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT_LONG);
		if ( timeZoneID != null ){
			TimeZone localZone = TimeZone.getTimeZone( timeZoneID );
			sdf.setTimeZone( localZone );
		}
    	Date date= null ;
		try {
			if ( strDate.length() <= 10 ) {
				strDate = strDate + " 00:00:00";
			}
			date=sdf.parse(strDate);
		}catch (java.text.ParseException e) {
			logger.error( e );
		}
		return date.getTime()/1000 ; 
	} 	
	
	public static java.sql.Date changeDateStrToTimestamp(String strDate) {
//		System.getProperties().setProperty("user.timezone", "GMT-0");
		return new java.sql.Date( converDateStrToSecond(strDate )*1000 );
	}
	
	/**
	 *  formate current date to xxxx-xx-xx;
	 * @param date Date
	 * @return string.
	 */
	public static String formatDateToStr(Date date) {
//		System.getProperties().setProperty("user.timezone", "GMT-0");
		SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT_SHORT);
//		sdf.setTimeZone(zone);
		return sdf.format(date);
	}
	
	/**
	 *  formate current date to xxxx-xx-xx;
	 * @param date Date
	 * @return string.
	 */
	public static String formatDateToTimeStr(Date date) {
		SimpleDateFormat sdf=new SimpleDateFormat(TIME_FORMAT);
		return sdf.format(date);
	}
	
	/**
	 *  formate current date to xxxx-xx-xx;
	 * @param date Date
	 * @return string.
	 */
	public static String formatDateToTimeStr(long misSenconds) {
		SimpleDateFormat sdf=new SimpleDateFormat(TIME_FORMAT);
		Date date = new Date( misSenconds ) ; 
		return sdf.format(date);
	}
	
	/**
	 * formate date 
	 * @param date
	 * @param localZone TimeZone
	 * @return
	 */
	public static String formatDateToStr(Date date,String timeZoneID) {
		SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT_SHORT);
		if ( timeZoneID != null) {
			TimeZone localZone = TimeZone.getTimeZone( timeZoneID );
			sdf.setTimeZone( localZone );
		}
		return sdf.format(date);
	}
	
	/**
	 * formate date to  xxxx-xx-xx xx:xx:xx
	 * @param date
	 * @return date string like xxxx-xx-xx xx:xx:xx
	 */
	public static String formateDateToLenStr(Date date) {
//		System.getProperties().setProperty("user.timezone", "GMT-0");
		SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT_LONG);
//		sdf.setTimeZone(zone);
		return sdf.format( date );
	}
	
 
	/**
	 * conver milsecond to yyyy-MM-dd HH:mm:ss
	 * @param milsecond
	 * @return
	 */
	public static String formateMilsecondToLenStr(Long milsecond) {
		SimpleDateFormat sdf=new SimpleDateFormat( DATE_FORMAT_LONG );
		return sdf.format( new Date(milsecond) );
	}
	
	public static String formatMilsecondsToLenStrWithTimezone(Long milsecond){
		SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT_LONG_WITH_TIMEZONE);
		return sdf.format( new Date(milsecond) );
	}
	
	/**
	 *  yyyy-MM-dd HH:mm:ss
	 * @param strDate
	 * @return string date like yyyy-MM-dd HH:mm:ss
	 */
	public static Date parseStrDateUseLenFormate( String strDate ) {
//		System.getProperties().setProperty("user.timezone", "GMT-0");
		if ( strDate.indexOf("T" ) !=-1 ) {
			strDate = strDate.replace("T", " ");
		}
		
		if ( strDate.length()>19)
			strDate = strDate.substring(0, 19);
		SimpleDateFormat sdf= new SimpleDateFormat(DATE_FORMAT_LONG);
//		sdf.setTimeZone(zone);
		Date date = null;
		try {
			if ( strDate != "" )
				date = sdf.parse( strDate );
			else 
				logger.error( "input date is '' ");
		} catch (ParseException ex) {
			date = new Date();
			logger.error( ex );
		}
		return date;
	}
	
	/**
	 *  yyyy-MM-dd  
	 * @param strDate
	 * @return string date like yyyy-MM-dd 
	 */
	public static Date parseStrDateUseShortFormate( String strDate ) {
//		System.getProperties().setProperty("user.timezone", "GMT-0");
		SimpleDateFormat sdf=new SimpleDateFormat( DATE_FORMAT_SHORT );
//		sdf.setTimeZone(zone);
		Date date = null;
		try {
			date = sdf.parse( strDate );
		} catch (ParseException ex) {
			logger.error( ex );
		}
		return date;
	}
	
	/**
	 * get  Calendar,Calendar will be set timezone(GMT-0).
	 * @return Calendar
	 */
	public static Calendar getGregorianCalendar () {
//		System.getProperties().setProperty("user.timezone", "GMT-0");
		Calendar calendar = GregorianCalendar.getInstance();
//		calendar.setTimeZone( zone );
		return calendar ; 
	}
	
	/**
	 * 
	 * @param date Date.
	 * @param days current Day. 
	 * @return
	 */
	public static String getBackwardDay( Date date, int days) {
		Calendar calendar = getGregorianCalendar();
		calendar.setTime(date);
		calendar.set(Calendar.HOUR, 0);
		calendar.set(Calendar.MINUTE, 0);
		calendar.set(Calendar.SECOND, 0);
		calendar.add(Calendar.DATE, -days);
		return formatDateToStr(  calendar.getTime() );
	}
	
	/**
	 * 
	 * @param date Date.
	 * @param days current Day. 
	 * @return
	 */
	public static Date getBackwardDayForDate( Date date, int days ) {
		Calendar calendar = getGregorianCalendar();
		calendar.setTime(date);
		calendar.set(Calendar.HOUR, 0);
		calendar.set(Calendar.MINUTE, 0);
		calendar.set(Calendar.SECOND, 0);
		calendar.add(Calendar.DATE, -days);
		return   calendar.getTime() ;
	}
	
	/**
	 * 
	 * @param date Date.
	 * @param days current Day. 
	 * @return
	 */
	public static String getForwardDay( Date date, int days ) {
		Calendar calendar = getGregorianCalendar();
		calendar.setTime(date);
		calendar.set(Calendar.HOUR, 0);
		calendar.set(Calendar.MINUTE, 0);
		calendar.set(Calendar.SECOND, 0);
		calendar.add(Calendar.DATE, days);
		return formatDateToStr(  calendar.getTime() );
	}
	
	/**
	 * get local timezone  point day
	 * @param dateStr 2008-09-02
	 * @param days 1 or -1 
	 * @return 2008-09-01 or 2008-09-03
	 */
	public static String getPointDay(String dateStr ,int days) {
		Calendar calendar = getGregorianCalendar();
		Date date = new Date( converDateStrToSecond( dateStr,null ) *1000 );
		calendar.setTime(date);
		calendar.set(Calendar.HOUR, 0);
		calendar.set(Calendar.MINUTE, 0);
		calendar.set(Calendar.SECOND, 0);
		calendar.add(Calendar.DATE, days);
		return formatDateToStr(  calendar.getTime() ,null );
	}
	
	/**
	 * 
	 * @param hoursRange  4 hours or -4 hours
	 * @return example 2010-06-21 19:22:11
	 */
	public static String getSpecifiedHourDateTime(int hoursRange){
		SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_LONG);
		Date date = new Date();
		Calendar calendar = GregorianCalendar.getInstance();
		calendar.setTime(date);
		calendar.add(Calendar.HOUR_OF_DAY, hoursRange);
		return sdf.format(calendar.getTime());
	}
	
	/**
	 *  yyyy-MM-dd HH:mm:ss
	 * @param millis millis second 
	 * @param hoursRange
	 * @return yyyy-MM-dd HH:mm:ss
	 */
	public static String getSpecifiedHourDateTime(long millis,int hoursRange){
		SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_LONG);
		Date date = new Date(millis);
		Calendar calendar = GregorianCalendar.getInstance();
		calendar.setTime(date);
		calendar.add(Calendar.HOUR_OF_DAY, hoursRange);
		return sdf.format(calendar.getTime());
	}
	
	/**
	 * 
	 * @param dateStr yyyy-MM-dd HH:mm:ss
	 * @param hoursRange
	 * @return yyyy-MM-dd HH:mm:ss
	 */
	public static String getSpecifiedHourDateTime(String dateStr,int hoursRange){
		SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_LONG);
		Date date =parseStrDateUseLenFormate( dateStr );
		Calendar calendar = GregorianCalendar.getInstance();
		calendar.setTime(date);
		calendar.add(Calendar.HOUR_OF_DAY, hoursRange);
		return sdf.format(calendar.getTime());
	}
	
	
	/**
	 * date===>yyyy-MM-dd===>yyyy-MM-dd yyyy-MM-dd HH:mm:ss===>seconds(from 1970/1/1 00:00:00)
	 * change date to point day zero time senconds.
	 * @param date
	 * @return
	 */
	public static long changeDateToZeroSecond( Date date ){
		SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT_SHORT);
		String strDate = sdf.format(date);
		Date localDate = null;
		try {
			if ( strDate.length() <= 10 ) {
				strDate = strDate + " 00:00:00";
			}
			localDate=sdf.parse(strDate);
		}catch (java.text.ParseException e) {
			logger.error( e );
		}
		return localDate.getTime()/1000 ; 
	}
	
	
	/**
	 * secondsToTimeStr( 57112) ==> 15:51:52
	 * this function write for dealing SFDC table yield_time field
	 * @param seconds
	 * @return formate HH:mm:ss
	 */
	public static String secondsToTimeStr(long seconds) {
		long hour = seconds/3600 ;
		long minutes = (seconds%3600)/60;
		long second = (seconds%3600)%60;
		return hour+":"+minutes+":"+second;
	}
	
	/**
	 * 
	 * @param dateTimeStr
	 * @return like 2010-06-07
	 */
	public static String getDateFromDateTimeStr(String dateTimeStr){
		return dateTimeStr.substring(0, 10) ;
	}
	
	public static String getTimeFromDateTimeStr(String dateTimeStr){
		return dateTimeStr.substring(11, 19);
	}
	
	public static int changeStrTimeToSecond(String timeStr){
		String[] strarray = timeStr.split(":");
		int senconds = Integer.parseInt(strarray[0])*3600 + Integer.parseInt(strarray[1])*60+Integer.parseInt(strarray[2]);
		return senconds;
	}

	public static String createSQLWhereCondition(String beginDateStr,String endDateStr,String shortName){
		StringBuffer buf = new StringBuffer();
		buf.append(" ");
		int beginTimeInt =changeStrTimeToSecond( getTimeFromDateTimeStr( beginDateStr ) );
		String beginStr =  ConvertFormula.getDateFromDateTimeStr( beginDateStr )+" 00:00:00";
		String endStr =  ConvertFormula.getDateFromDateTimeStr( endDateStr )+" 00:00:00";
		int endTimeInt = ConvertFormula.changeStrTimeToSecond( ConvertFormula.getTimeFromDateTimeStr( endDateStr ));	
		if (  gettotalDateFromDateStr(beginDateStr) == gettotalDateFromDateStr(endDateStr) ){
			buf.append(" AND (");
			buf.append(shortName+".\"a_time\">"+beginTimeInt+ " AND  ");
			buf.append(shortName+".\"a_time\"<="+endTimeInt+ " AND  ");
			buf.append(shortName+".\"a_date\"='"+beginStr+"' ");
			buf.append(" ) ");
		} else if ( (gettotalDateFromDateStr(endDateStr) - gettotalDateFromDateStr(beginDateStr)) == 1 ){
			buf.append("  AND ( (");
			buf.append(shortName+".\"a_time\">"+beginTimeInt+ " AND  ");
			buf.append(shortName+".\"a_date\"='"+beginStr+"' ");
			buf.append(") OR (");
			buf.append(shortName+".\"a_time\"<="+endTimeInt+ " AND  ");
			buf.append(shortName+".\"a_date\"='"+endStr+"' ");
			buf.append(") ) ");
		} else if  ( (gettotalDateFromDateStr(endDateStr) - gettotalDateFromDateStr(beginDateStr)) > 1 ){
			buf.append(" AND ( (");
			buf.append(shortName+".\"a_time\">"+beginTimeInt+ " AND  ");
			buf.append(shortName+".\"a_date\"='"+beginStr+"' ");
			buf.append(") OR (");
			String addDateStr = getPointDate( beginDateStr ,1)+" 00:00:00";
			String minDateStr = getPointDate( endDateStr ,-1)+" 00:00:00";
			buf.append(shortName+".\"a_date\">='"+addDateStr+"'  AND ");
			buf.append(shortName+".\"a_date\"<='"+minDateStr+"' ");
			buf.append(" ");
			buf.append(") OR (");
			buf.append(shortName+".\"a_time\"<="+endTimeInt+ " AND  ");
			buf.append(shortName+".\"a_date\"='"+endStr+"' ");
			buf.append(") ) ");
		}
		return buf.toString();
	}
	
	/**
	 * static the datestr days
	 * @param date
	 * @return
	 */
	public static int gettotalDateFromDateStr(String date){
		int rtvInt = 0;
		if ( date.length()>=10){
			String dateStr = date.substring(0, 10);
			int year = Integer.parseInt( dateStr.substring(0,4) );
			int month = Integer.parseInt( dateStr.substring(5,7) );
			int day = Integer.parseInt( dateStr.substring(8,10) );
			int totalDay = 0;
			for( int i=START_YEAR;i<year;i++){
				if ( i%4==0)
					totalDay = totalDay+366;
				else
					totalDay = totalDay+365;
			}
			
			for(int i=1;i<month;i++){
				if ( year%4 ==0){
					if ( i==2 ){
					totalDay= totalDay + 29;
					} else{
						totalDay= totalDay + 28;
					}
				} else {
					totalDay= totalDay + monthDaysDistribute[i-1];
				}
			}
			rtvInt = totalDay + day;
			  
		}
		return rtvInt;
	}
	
	/**
	 * 
	 * @param date yyyy-MM-dd HH:mm:ss
	 * @param days number
	 * @return  yyyy-MM-dd
	 */
	public static String getPointDate( String date, int days) {
		String rtvStr = "";
		if ( date.length()>=10){
			String dateStr = date.substring(0, 10);
			int year = Integer.parseInt( dateStr.substring(0,4) );
			int month = Integer.parseInt( dateStr.substring(5,7) );
			int day = Integer.parseInt( dateStr.substring(8,10) );
			int totalDay = 0;
			 
			for( int i=START_YEAR;i<year;i++){
				if ( i%4==0)
					totalDay = totalDay+366;
				else
					totalDay = totalDay+365;
			}
			
			for(int i=1;i<month;i++){
				if ( year%4 ==0){
					if ( i==2 ){
					totalDay= totalDay + 29;
					} else{
						totalDay= totalDay + 28;
					}
				} else {
					totalDay= totalDay + monthDaysDistribute[i-1];
				}
			}
			totalDay = totalDay + day;
			totalDay = totalDay + days;
			rtvStr = daysToDateStr(totalDay);
		}
		return rtvStr;
	}
	
	/**
	 * 
	 * @param totalDay total day
	 * @return yyyy-MM-dd
	 */
	public static String daysToDateStr(int totalDay){
		String rtvStr = "";
		int cyear=START_YEAR ;
		for( int i=START_YEAR;;i++){
			if ( i%4==0){
				if ( ( totalDay-366)>0)
					totalDay = totalDay - 366;
				else {
					cyear = i;
					break;
				}
			} else{
				if ( ( totalDay-365)>0)
					totalDay = totalDay - 365;
				else {
					cyear = i;
					break;
				}
			}
		}
		
		int cmonth = 1;
		for( int i=1;i<=12;i++){
			if ( cyear%4==0 && i==2 ) {
				if (  (totalDay-29)>0){
					totalDay = totalDay - 29;
				} else {
					cmonth = i;
					break;
				}
				
			}else {
				if ( ( totalDay-monthDaysDistribute[i-1])>0)
					totalDay = totalDay - monthDaysDistribute[i-1];
				else {
					cmonth = i;
					break;
				}
			}
		}
		
		rtvStr = ""+cyear;
		if ( cmonth<=9)
			rtvStr = rtvStr+"-0"+cmonth;
		else
			rtvStr = rtvStr +"-"+cmonth;
		
		if ( totalDay<=9)
			rtvStr = rtvStr+"-0"+totalDay;
		else
			rtvStr = rtvStr+"-"+totalDay;
		
		return rtvStr;
	}
	
	/**
	 * 
	 * @param dateStr  yyyy-MM-dd HH:mm:ss
	 * @param hour  -4 or 4
	 * @return
	 */
	public static String getDayAccordDateTimeStrForHour(String dateStr,int hour){
		String rtvStr = "";
		if ( dateStr.length()>=19){
			int days =gettotalDateFromDateStr( dateStr );
			String  currentHoursStr = dateStr.substring(11, 13) ;
			String  minuteSeconds = dateStr.substring(13, 19);
			int hours = days *24 + Integer.parseInt(currentHoursStr);
			hours = hours + hour;
			days = hours/24;
			hours=hours%24;
			if ( hours<=9 )
				rtvStr = daysToDateStr(days) + " 0"+hours+ minuteSeconds;
			else
				rtvStr = daysToDateStr(days) + " "+hours+ minuteSeconds;
		}
		return rtvStr;
	}
	
	/**
	 * 
	 * @param dateStr  yyyy-MM-dd HH:mm:ss
	 * @param hour  -4 or 4 minutes
	 * @return
	 */
	public static String getDayAccordDateTimeStrForMinutes(String dateStr,int minutes){
		String rtvStr = "";
		if ( dateStr.length()>=19){
			int days =gettotalDateFromDateStr( dateStr );
			String  currentHoursStr = dateStr.substring(11, 13) ;
			String  currentMinutesStr = dateStr.substring(14, 16) ;
			String  seconds = dateStr.substring(16, 19);
			long totalMinutes = days *24 * 60 + Long.parseLong( currentHoursStr)*60 + Long.parseLong(currentMinutesStr);
			totalMinutes = totalMinutes + minutes;
			days = (int)(totalMinutes/60/24);
			int hours= (int)(totalMinutes%(24*60)/60);
			minutes= (int)(totalMinutes%(24*60)%60);
			
			rtvStr = daysToDateStr(days) + " ";
			if ( hours<=9 )
				rtvStr = rtvStr + "0"+ hours+":";
			else
				rtvStr = rtvStr +  hours+":";
			if ( minutes<=9)
				rtvStr = rtvStr + "0"+ minutes+ seconds;
			else
				rtvStr = rtvStr +  minutes+seconds;
		}
		return rtvStr;
	}
	
	public static String getCurrentStrDateTime(){
		SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_LONG);
		Date date = new Date();
		Calendar calendar = GregorianCalendar.getInstance();
		calendar.setTime(date);
		return sdf.format(calendar.getTime());
	}
	
	/**
	 * example: FormatPercent(0.33333333,2) = 33%
	 * @param number
	 * @param newValue
	 * @return
	 */
	public static String formatPercent(double number,int accurate) {
        java.text.NumberFormat nf = java.text.NumberFormat.getPercentInstance();
        nf.setMinimumFractionDigits(accurate);
        return nf.format(number) ;
	}
	
	public static long getCurrentMillisDateTime(){
		Date date = new Date();
		return date.getTime();
	}

	
	/**
	 * main. used to test.
	 * @param args -String
	 */
	public static void main(String []args){	
		int total = 76;
		int one = 4 ; 
		double dnum = ( (double)one/total);
		logger.info( formatPercent(dnum ,3));
		logger.info(  getPointDate("2010-06-17",-17));
		logger.info( getDayAccordDateTimeStrForHour("2010-06-17 02:02:20",-2) );
		logger.info( getDayAccordDateTimeStrForMinutes("2010-06-17 01:00:20",-1449) );
		logger.info( createSQLWhereCondition("2010-12-27 21:30:00","2011-01-01 00:30:00","a") );
	}
	
}

